<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <link rel="stylesheet" type="text/css" href="/stylesheets/main.css" />
    <title> .:: Scout Screen Synchronizer ::. </title>
</head>
<body>
    <h3> .:: Scout Screen Synchronizer ::. </h3>
    <div id="left">
        <fieldset>
            <legend>Update Database</legend>
            <form method="post" action="/hivemind/update">
                <p><input type="submit" name="update" value="Update" id="update-button" class="button" />{{ update_status }}</p>
            </form>
        </fieldset>
        <fieldset>
            <legend>Search</legend>
            <form method="post" action="/hivemind/search">
                <p>
                    <input type="radio" name="searchby" value="player" id="player" checked="checked" /><label for="player" class="radio">Player</label><br />
                    <input type="radio" name="searchby" value="planet" id="planet" /><label for="planet" class="radio">Planet</label>
                    <input type="text" name="searched_term" value="" class="textfield-medium" />
                    <input type="submit" name="search" value="Search" class="button" />
                </p>
            </form>
        </fieldset>
        <fieldset>
            <legend>Logout</legend>
            <form action="/hivemind/logout" method="post">
                <p><input type="submit" name="logout" value="Logout" id="logout-button" class="button" /><span class="text-standard">[ Logout from Hyperiums ]</span></p>
            </form>
        </fieldset>
    </div>
    <div id="right">
        <fieldset class="result">
            <legend>Results</legend>
            {{ search_status }}
            {% ifequal searchby "planet" %}
                <fieldset>
                    <legend>Present fleets on planet <strong>{{ location.name }}</strong> Stasis [<strong>{% ifequal location.stasis "0" %}DOWN{% else %}UP{% endifequal %}</strong>]</legend>
                    <table cellspacing="3" cellpadding="0" class="content-table">
                        <tr>
                            <th class="table-header">Owner</th>
                            <th class="table-header">Defending</th>
                            <th class="table-header">Race</th>
                            <th class="table-header">Cruisers</th>
                            <th class="table-header">Destroyers</th>
                            <th class="table-header">Bombers</th>
                            <th class="table-header">Scouts</th>
                            <th class="table-header">CAs</th>
                            <th class="table-header">GAs</th>
                        </tr>
                        {% for fleet in res_fleets %}
                            <tr>
                                <td class="table-cell">{{ fleet.owner.name }}</td>
                                <td class="table-cell">{{ fleet.defend }}</td>
                                <td class="table-cell">{{ fleet.frace }}</td>
                                <td class="table-cell">{{ fleet.crui }}</td>
                                <td class="table-cell">{{ fleet.dest }}</td>
                                <td class="table-cell">{{ fleet.bomb }}</td>
                                <td class="table-cell">{{ fleet.scou }}</td>
                                <td class="table-cell">{{ fleet.carmies }}</td>
                                <td class="table-cell">{{ fleet.garmies }}</td>
                            </tr>
                        {% endfor %}
                    </table>
                </fieldset>
                <p class="text-standard">Last update : <strong>{{ location.date.date }}</strong> at <strong>{{ location.date.hour }}:{{ location.date.minute }}</strong> ST</p>
            {% endifequal %}
            {% ifequal searchby "player" %}
                {% for planet in res_planets %}
                    <fieldset>
                        <legend>Fleets owned by player <strong>{{ player }}</strong> on planet <strong>{{ planet.0.location.name }}</strong></legend>
                        <table cellspacing="3" cellpadding="0" class="content-table">
                            <tr>
                                <th class="table-header">Defending</th>
                                <th class="table-header">Race</th>
                                <th class="table-header">Cruisers</th>
                                <th class="table-header">Destroyers</th>
                                <th class="table-header">Bombers</th>
                                <th class="table-header">Scouts</th>
                                <th class="table-header">CAs</th>
                                <th class="table-header">GAs</th>
                            </tr>
                            {% for fleet in planet %}
                                <tr>
                                    <td class="table-cell">{{ fleet.defend }}</td>
                                    <td class="table-cell">{{ fleet.frace }}</td>
                                    <td class="table-cell">{{ fleet.crui }}</td>
                                    <td class="table-cell">{{ fleet.dest }}</td>
                                    <td class="table-cell">{{ fleet.bomb }}</td>
                                    <td class="table-cell">{{ fleet.scou }}</td>
                                    <td class="table-cell">{{ fleet.carmies }}</td>
                                    <td class="table-cell">{{ fleet.garmies }}</td>
                                </tr>
                            {% endfor %}
                        </table><br />
                    </fieldset>
                {% endfor %}
            {% endifequal %}
        </fieldset>
    </div>
</body>
</html>
